package com.mts.indicatorcommon.dictinfo.converter

import com.mts.indicatorcommon.dictinfo.vo.DictInfoVo
import com.mts.indicatorjpa.dictinfo.entity.DictInfoEntity
import org.mapstruct.Mapper
import org.mapstruct.Mapping
import org.mapstruct.Mappings
import org.mapstruct.ReportingPolicy
import org.mapstruct.factory.Mappers

/**
 *
 *
 * <pre>
 *      DictInfoConverter
 * </pre>
 *
 * @author Johnny
 * @date 2025-08-22
 */
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
interface DictInfoConverter {

    companion object {
        val INSTANCE: DictInfoConverter = Mappers.getMapper(DictInfoConverter::class.java)
    }
    /**
     * 实体 转 vo
     * @param entity : DictInfoEntity
     * @return : DictInfoVo
     */
    @Mappings(
     Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
     Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    )
    fun domain2vo(entity: DictInfoEntity): DictInfoVo

    /**
     * vo 转 实体
     * @param vo : DictInfoVo
     * @return : DictInfoEntity
     */
    @Mappings(
     Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
     Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    )
    fun vo2domain(vo: DictInfoVo): DictInfoEntity
}
